package com.zxh.zhenxihuan.controller;

import com.alibaba.fastjson.JSON;
import com.zxh.zhenxihuan.entity.Merchants;
import com.zxh.zhenxihuan.mapper.MerchantsMapper;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author:geQiang
 * @version:1.0
 * @date:2019/8/1
 * @description:com.zxh.zhenxihuan.controller
 */
@RestController
@CrossOrigin
public class MerchantsController {
    @Resource
    MerchantsMapper merchantsMapper;
    @PostMapping("/findmerchants")
    public List<Merchants> findmerchants(){
        return merchantsMapper.findMerchants();
    }

    @PostMapping("/update_pwd")
    public String updatePwd(@RequestBody Map maps){
        Long id= (Long) maps.get("id");
        String pwd= (String) maps.get("pwd");
        Long num=merchantsMapper.updateUserPass(id,pwd);
        return JSON.toJSONString(num);
    }




}
